package cn.dengta.webapp.trade.dto;

import cn.dengta.webapp.base.vo.AbstractVO;
import cn.dengta.webapp.trade.entity.UserCoinLog;
import lombok.Getter;
import lombok.Setter;
import me.codeplayer.util.Cmp;
import me.codeplayer.util.NumberUtil;

@Getter
@Setter
public class UserCoinLogSumDTO extends AbstractVO<UserCoinLog> {

	/** 用户ID */
	public Long userId;
	/** 业务类型 TradeType */
	protected String tradeType;
	/** 交易总金额 */
	public Long totalTradeAmount;
	/** 交易免费总金额 */
	public Long totalFreeTradeAmount;
	/** 活动支出 */
	public Long activityCoin;
	/** 打赏支出 */
	public Long donateCoin;
	/** 游戏兑换 */
	public Long gameCoin;
	/** 兑换金钻消耗 */
	public Long exchangeGoldCoin;
	/** 金钻打赏礼物 */
	public Long giftGoldCoin;
	/** 搭讪总钻石 */
	public Long greetCoin;
	/** 聊天总钻石 */
	public Long msgCoin;
	/** 语音总钻石 */
	public Long audioCoin;
	/** 视频总钻石 */
	public Long videoCoin;
	/** 1v1礼物钻石 */
	public Long giftCoin;
	/** 直播礼物总钻石 */
	public Long giftLiveCoin;
	/** 礼物总钻石 */
	public Long giftTotalCoin;
	/** 文字总支出 */
	public Long msgTotalCoin;

	public Long getTotalTradeAmountTurnZero() {
		return NumberUtil.getLong(totalTradeAmount, 0L);
	}

	public UserCoinLogSumDTO init(UserCoinLogSumDTO input) {
		this.totalTradeAmount = Cmp.nullToZero(input.totalTradeAmount);
		this.totalFreeTradeAmount = Cmp.nullToZero(input.totalFreeTradeAmount);
		this.activityCoin = Cmp.nullToZero(input.activityCoin);
		this.donateCoin = Cmp.nullToZero(input.donateCoin);
		this.gameCoin = Cmp.nullToZero(input.gameCoin);
		this.exchangeGoldCoin = Cmp.nullToZero(input.exchangeGoldCoin);
		this.giftGoldCoin = Cmp.nullToZero(input.giftGoldCoin);
		this.greetCoin = Cmp.nullToZero(input.greetCoin);
		this.msgCoin = Cmp.nullToZero(input.msgCoin);
		this.audioCoin = Cmp.nullToZero(input.audioCoin);
		this.videoCoin = Cmp.nullToZero(input.videoCoin);
		this.giftCoin = Cmp.nullToZero(input.giftCoin);
		this.giftLiveCoin = Cmp.nullToZero(input.giftLiveCoin);
		this.msgTotalCoin = this.greetCoin + this.msgCoin;
		this.giftTotalCoin = this.giftGoldCoin + this.giftCoin + this.giftLiveCoin;
		return this;
	}

}
